﻿#include "widget.h"
#include <QApplication>
#include "tfmainwindow.h"
#include <QUrl>
#include <qdebug.h>
#include <tfframe.h>
#include<iostream>

#include <QQuickView>
#include "wordcloundframe.h"
#include "tfflickviewer.h"

#define WORDCLOUND
using namespace std;

QUrl checkUrl(const QString &stringurl)
{
    QUrl url(stringurl);
    QString tmpurl("https://www.baidu.com/s?wd=");
    if(url.scheme().isEmpty()){
        if(stringurl.split(".").size() <= 1){
            tmpurl.append(stringurl);
            return QUrl(tmpurl);
        }
        url.setScheme("http");
        if(url.isValid()){
            return url;
        }else{
            tmpurl.append(stringurl);
            return QUrl(tmpurl);
        }
    }
    return url;
}
int main(int argc, char *argv[])
{
//    qputenv("QT_QUICK_CONTROLS_STYLE", "material");
    QApplication a(argc, argv);
    a.setFont(QFont(QStringLiteral("微软雅黑"),12));
#if 0
    TFMainWindow mainW;
    mainW.show();
//#elif 1
//    Widget w;
//    w.show();
#else

#ifndef WORDCLOUND
//    WordCloundFrame frame;
//    frame.resize(600,600);
//    frame.show();
#else
    QQuickView *view = new QQuickView();
    view->setSurfaceType(QSurface::OpenGLSurface);
    view->setSource(QUrl::fromLocalFile("FlowLayoutPage.qml"));
    view->setResizeMode(QQuickView::SizeRootObjectToView);
    view->resize(600,600);
    view->show();

    TFFlickViewer viewer;
    viewer.resize(600,600);
    viewer.show();
#endif
#endif
    return a.exec();
}
